﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.Core.Profile;
using COFE.Core.Lister;
using COFE.Core.Utils;
using NUnit.Framework;

namespace COFE.IO.FSIEX
{
    public class FileSystemExFactory : IFactory<IDirectoryLister>
    {
        public FileSystemExFactory(string factoryKey)
        {
            Assert.IsNotNullOrEmpty(factoryKey);
            FactoryKey = factoryKey;
        }

        public string FactoryKey { get; private set; }

        public IDirectoryLister Construct(string id, string paramString)
        {
            var paramDic = StringUtils.ParamStringToDic(paramString);

            if (paramDic.ContainsKey("path"))
                return new FileSystemExDirectoryLister(this, id, paramDic["path"]);
            else return new FileSystemExDirectoryLister(null, id);

        }

        public string Recycle(IDirectoryLister product)
        {
            return "path=" + (product as FileSystemExDirectoryLister).RootPath;
        }


    }
}
